package org.jivesoftware.smackx.provider;

import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.packet.DiscoverItems;
import org.jivesoftware.smackx.packet.DiscoverItems.Item;
import org.xmlpull.v1.XmlPullParser;

public class DiscoverItemsProvider
  implements IQProvider
{
  public IQ parseIQ(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    DiscoverItems localDiscoverItems = new DiscoverItems();
    int i = 0;
    String str1 = "";
    String str2 = "";
    String str3 = "";
    String str4 = "";
    localDiscoverItems.setNode(paramXmlPullParser.getAttributeValue("", "node"));
    while (true)
    {
      int j;
      do
        while (true)
        {
          while (true)
          {
            if (i != 0)
              return localDiscoverItems;
            j = paramXmlPullParser.next();
            if ((j != 2) || (!("item".equals(paramXmlPullParser.getName()))))
              break;
            str1 = paramXmlPullParser.getAttributeValue("", "jid");
            str2 = paramXmlPullParser.getAttributeValue("", "name");
            str4 = paramXmlPullParser.getAttributeValue("", "node");
            str3 = paramXmlPullParser.getAttributeValue("", "action");
          }
          if ((j != 3) || (!("item".equals(paramXmlPullParser.getName()))))
            break;
          DiscoverItems.Item localItem = new DiscoverItems.Item(str1);
          localItem.setName(str2);
          localItem.setNode(str4);
          localItem.setAction(str3);
          localDiscoverItems.addItem(localItem);
        }
      while ((j != 3) || (!("query".equals(paramXmlPullParser.getName()))));
      i = 1;
    }
  }
}